<div class="header_menu">
    <div class="container">
        <div class="header-nav clearfix">
            <?php echo $this->partial('site/headermenu'); ?>
        </div>
    </div>
</div>
</div>

<div class="container">
    <div class="xm-plain-box">
        <div class="box-hd">
            <h3 class="title"><?php echo $this->translate('会员信息补充或绑定已有账户'); ?></h3>
        </div>
        <div class="box-bd">
            <div class="row">

                <div class="control-group">
                    <div class="message_one">
                    </div>
                </div>
                <?php if ($this->frontwebsite()->getUserIni('user_register_state') == 'true') { ?>
                    <form class="form-horizontal" method="post" name="other_register_form" id="other_register_form">
                        <input type="hidden" name="other_logion_type" value="register">
                        <div class="control-group">
                            <label for="input01" class="control-label"><?php echo $this->translate('会员名称'); ?>：</label>
                            <div class="controls">
                                <input type="text" id="user_name" placeholder="<?php echo $this->translate('输入会员名称'); ?>" name="user_name" value="<?php echo $this->other_user_info['nickname']; ?>">
                            </div>
                        </div>
                        <?php if($this->other_login_email_state == 'true') { ?>
                        <div class="control-group">
                            <label for="input01" class="control-label"><?php echo $this->translate('电子邮箱'); ?>：</label>
                            <div class="controls">
                                <input type="text" id="user_email" name="user_email" placeholder="<?php echo $this->translate('输入电子邮件'); ?>">
                            </div>
                        </div>
                        <?php } ?>
                        <div class="control-group">
                            <div class="controls">
                                <button class="btn btn-primary" type="submit"><?php echo $this->translate('提交补充信息(建立账户)'); ?></button>
                            </div>
                        </div>
                    </form>
                    <hr>
                    <form class="form-horizontal" method="post" name="other_login_form" id="other_login_form">
                        <input type="hidden" name="other_logion_type" value="login">
                        <div class="control-group">
                            <label for="input01" class="control-label"><?php echo $this->translate('会员名称'); ?>：</label>
                            <div class="controls">
                                <input type="text" id="login_user_name" placeholder="<?php echo $this->translate('输入会员名称'); ?>" name="login_user_name" value="">
                            </div>
                        </div>
                        <div class="control-group">
                            <label for="input01" class="control-label"><?php echo $this->translate('会员密码'); ?>：</label>
                            <div class="controls">
                                <input type="text" id="login_user_passwd" name="login_user_passwd" placeholder="<?php echo $this->translate('请输入会员密码'); ?>">
                            </div>
                        </div>
                        <div class="control-group">
                            <div class="controls">
                                <button class="btn btn-primary" type="submit"><?php echo $this->translate('提交绑定现有账户'); ?></button>
                            </div>
                        </div>
                    </form>
                <?php } else {
                    echo '<div><h4>'. $this->frontwebsite()->getUserIni('register_close_message') . '</h4></div>';
                } ?>

            </div>
        </div>
    </div>
</div>

<script>
    <?php if (isset($this->message) and $this->message != '') { ?>
    show_message('.message_one','<?php echo date("Y-m-d H:i:s",time()); ?>','<?php echo $this->message; ?>','alert-error');
    <?php } ?>
    //客户补充信息保存验证
    $(document).ready(function() {
        $("#other_register_form").validate({
            success : function(label){
                label.addClass('validate_right').text('OK!');
            },
            rules: {
                user_name: {
                    required: true,
                    maxlength:30,
                    remote :{
                        url : '<?php echo $this->url('frontuser/default/user_id',array('action'=>'check','controller'=>'user','check_type'=>'user_name','user_id'=>($this->user_info ? $this->user_info->user_id : '0'))); ?>',
                        type : 'post',
                        date : {
                            user_name :function(){
                                return $('#user_name').val();
                            }
                        }
                    }
                }
                <?php if($this->other_login_email_state == 'true') { ?>
                ,
                user_email: {
                    required: true,
                    email: true,
                    remote :{
                        url : '<?php echo $this->url('frontuser/default/user_id',array('action'=>'check','controller'=>'user','module'=>'user','check_type'=>'user_email','user_id'=>($this->user_info ? $this->user_info->user_id : '0'))); ?>',
                        type : 'post',
                        date : {
                            user_email :function(){
                                return $('#user_email').val();
                            }
                        }
                    }
                }
                <?php } ?>
            },
            messages: {
                user_name: {
                    required: "<?php echo $this->translate('请输入客户登录名称！'); ?>",
                    maxlength:"<?php echo $this->translate('客户登录名称最长为30个汉字！'); ?>",
                    remote: "<?php echo $this->translate('该用户名已经存在！'); ?>"
                },
                user_email: {
                    required: "<?php echo $this->translate('请输入电子邮箱！'); ?>",
                    email: "<?php echo $this->translate('电子邮箱格式错误！'); ?>",
                    remote: "<?php echo $this->translate('该邮箱已经存在'); ?>"
                }
            }
        });

        $("#other_login_form").validate({
            success : function(label){
                label.addClass('validate_right').text('OK!');
            },
            rules: {
                login_user_name: {
                    required: true
                },
                login_user_passwd: {
                    required: true
                }
            },
            messages: {
                login_user_name: {
                    required: "<?php echo $this->translate('会员名称不能为空！'); ?>"
                },
                login_user_passwd: {
                    required: "<?php echo $this->translate('会员密码不能为空！'); ?>"
                }
            }
        });

    });

</script>